{include_core file="m/lib/header.html" title="关联NBD账号"}
<div class="associated-page">
	<div class="login-box associate2">
    <!-- <div class="header">
      <h2>关联NBD账号</h2>
    </div> -->
    <div class="input-list">
	<form action = "{AnUrl('openapi/check_bind')}" id="btn_c_form" method="post">
      <div class="input-txt">
        <label><input type="text" placeholder="邮箱/手机号/NBD账号" name="username" id="username"/></label>
        <label><input type="password" placeholder="密码" name="password" id="password"/></label>
      </div>
    </form>
      <p><a href="javascript:void(0);" id="btn_login" class="login-btn">立即绑定</a></p>
      <p><a href="{AnUrl('openapi/bind_new')}" class="register-btn">创建新账号</a></p>
    </div>
  </div>
</div>
<script>
$(function(){
  $('#btn_login').click(function(){
    $('#btn_login').html('正在绑定...');
    var username = $.trim($('#username').val());
    var password = $.trim($('#password').val());
    if(username == '') {
      mobileShowMsg('用户名不能为空');
      $('#btn_login').html('立即绑定');
      return;
    } 
    if(password == '') {
      mobileShowMsg('密码不能为空');
      $('#btn_login').html('立即绑定');
      return;
    }
    
    $.post(
        "{AnUrl('openapi/check_bind')}",
        { "username" : username, "password":password },
        function(data){
          if(data.info == 'error') {
            if(data.type == 'user') {
              mobileShowMsg(data.msg);
              $('#btn_login').html('立即登录');
              return;
            } else {
              mobileShowMsg(data.msg);
              $('#btn_login').html('立即登录');
              return;
            }
          } else {
            $('#btn_c_form').submit();
          }
        },'json');
    
  });
})
  </script>
{include_core file="m/lib/footer.html"}